<template>
<div>
  <van-nav-bar fixed>
  <template #right>
    <van-icon name="search" size="0.48rem" color="#fff" />
  </template>
  <template #left>
    <img class="logo" src="../../assets/toutiao_logo.png" alt="">
 </template>
  </van-nav-bar>
   <van-tabs v-model="channelId"
      animated
      sticky
      offset-top="1.226667rem">
  <van-tab v-for="item in channelList" :title="item.name" :key="item.id" :name="item.id">
  <ArticleList :cid="channelId"/>
   </van-tab>
  </van-tabs>
 </div>
</template>

<script>
import { userChannelAPI } from '@/api'
import ArticleList from '@/views/Home/ArticleList'
export default {
  data () {
    return {
      channelId: 0,
      channelList: []
    }
  },
  async created () {
    const res = await userChannelAPI()
    // console.log(res)
    const { channels } = res.data.data
    this.channelList = channels
  },
  components: {
    ArticleList
  }
}
</script>

<style scoped lang="less">
.logo {
    width: 100px;
    height: 30px;
}
/deep/ .van-tabs__content{
    padding-top: 44px;
}
</style>
